package ThreadPoolExample;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPool1 {
    public static void main(String[] args) {
        //创建一个固定大小的线程池
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        //向线程2提交任务
        for (int i = 0; i < 10; i++) {
            executorService.execute(new RunnableTest());
        }
        //关闭线程池
        executorService.shutdown();
    }
}
